package com.sskj.phoenixcoin.activity;


import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.sskj.common.util.ClickUtil;
import com.sskj.common.util.NumberUtil;
import com.sskj.common.util.TimeFormatUtil;
import com.sskj.lib.base.BaseActivity;
import com.sskj.lib.util.HideUtil;
import com.sskj.phoenixcoin.R;
import com.sskj.phoenixcoin.bean.AppRecord;
import com.sskj.phoenixcoin.presenter.AppTransferDetailActivityPresenter;

import butterknife.BindView;
import butterknife.ButterKnife;


public class AppTransferDetailActivity extends BaseActivity<AppTransferDetailActivityPresenter> {
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.right_tv)
    TextView rightTv;
    @BindView(R.id.other_account)
    TextView otherAccount;
    @BindView(R.id.mine_account)
    TextView mineAccount;
    @BindView(R.id.money)
    TextView money;
    @BindView(R.id.date)
    TextView date;
    private AppRecord.Record recordDetail;

    @Override
    protected int getLayoutResId() {
        return R.layout.app_activity_transfer_detail;
    }

    @Override
    public AppTransferDetailActivityPresenter getPresenter() {
        return new AppTransferDetailActivityPresenter();
    }

    @Override
    protected void initView() {
        super.initView();
        recordDetail = (AppRecord.Record) getIntent().getSerializableExtra("record");
        ClickUtil.click(ivBack, () -> {
            finish();
        });
        tvTitle.setText("转账详情");
        otherAccount.setText(HideUtil.getPhoneHide(recordDetail.getSelfTel()));
        mineAccount.setText(HideUtil.getPhoneHide(recordDetail.getOtherTel()));
        money.setText(NumberUtil.keepMax2(recordDetail.getCoinNum()) + "FHB");
        date.setText(TimeFormatUtil.SF_FORMAT_E.format(Double.valueOf(recordDetail.getCreateTime())));
    }

    public static void start(Context context, AppRecord.Record record) {
        Intent intent = new Intent(context, AppTransferDetailActivity.class);
        intent.putExtra("record", record);
        context.startActivity(intent);
    }

}
